// components/myHouse-item.js/myHouseItem.js.js
import {
  delRoom
} from '../../api/myHouse'
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    item: {
      type: Object
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    startLeft: 0,
    left: 0,
    show: true,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    start(e) {
      let left = e.changedTouches[0].pageX
      this.setData({
        startLeft: left,
      })
    },
    move(e) {
      let left = e.changedTouches[0].pageX - this.data.startLeft
      if (left < -80) left = -80
      if (left > 0) left = 0
      this.setData({
        left: left,
      })
    },
    end() {
      let left = this.data.left
      if (left < -40) left = -80
      if (left >= -40) left = 0
      this.setData({
        left: left,
      })
    },
    del() {
      console.log(123);
      this.triggerEvent('del', {
        id: this.data.item.id
      })
    }
  }
})